<%@page import="com.glowdayz.glowmee.dao.ProductDAO"%>
<%@page import="com.glowdayz.glowmee.cmd.ProductCMD"%>
<%@page import="com.glowdayz.common.DBHandler"%>
<%@page import="java.util.ArrayList"%>
<%@ page language="java" contentType="text/xml; charset=UTF-8" pageEncoding="UTF-8" %>
<%@ page trimDirectiveWhitespaces="true" %>
<%
	String brand = request.getParameter("brand");

	if (brand.equals("default")) {
	%>
<?xml version="1.0" encoding="utf-8" ?>
<brand>
	<item>
		<idProduct>default</idProduct>
		<productTitle>- 브랜드를 먼저 선택하세요 -</productTitle>
	</item>
</brand>
	<%	
		return;
	}
	DBHandler.getInstance().connect();
	ArrayList<ProductCMD> cmd = ProductDAO.getInstance().getProductList(1, -1, "p.productTitle", " AND p.idBrand=" + brand);
	if (cmd != null) {
%>
<?xml version="1.0" encoding="utf-8" ?>
<brand>
	<item>
		<idProduct>default</idProduct>
		<productTitle>- 제품을 선택하세요 -</productTitle>
	</item>
	<%
		for (int i=0; i<cmd.size(); i++) {
			ProductCMD temp = cmd.get(i);
	%>
	<item>
		<idProduct><%= temp.getIdProduct() %></idProduct>
		<productTitle><%= temp.getProductTitle() %></productTitle>
	</item>
	<%
		}
		DBHandler.getInstance().disconnect();
	%>
</brand>
<%
	} else {
%>
<?xml version="1.0" encoding="utf-8" ?>
<brand>
	<item>
		<idProduct>default</idProduct>
		<productTitle>- 해당 브랜드 제품없음 -</productTitle>
	</item>
</brand>
<%}%>